#! /bin/bash
HIVE_HOME=/usr/bin/hive


${HIVE_HOME} -S -e "

create table zx_rpt.rpt_need_total
(
    class_date              string,
    class_id                string,
    studying_student_count  bigint,

    morning_num_attend      bigint,
    morning_att_ratio       decimal(5,2),
    afternoon_num_attend    bigint,
    afternoon_att_ratio     decimal(5,2),
    evening_num_attend      bigint,
    evening_att_ratio       decimal(5,2),

    morning_late_num        bigint,
    morning_late_ratio      decimal(5,2),
    afternoon_late_num      bigint,
    afternoon_late_ratio    decimal(5,2),
    evening_late_num        bigint,
    evening_late_ratio      decimal(5,2),

    morning_leave_count     bigint,
    morning_leave_ratio     decimal(5,2),
    afternoon_leave_count   bigint,
    afternoon_leave_ratio   decimal(5,2),
    evening_leave_count     bigint,
    evening_leave_ratio     decimal(5,2),

    morning_truant_count    bigint,
    morning_truant_ratio    decimal(5,2),
    afternoon_truant_count  bigint,
    afternoon_truant_ratio  decimal(5,2),
    evening_truant_count    bigint,
    evening_truant_ratio    decimal(5,2)
)
row format delimited
fields terminated by '/t'
stored as orc
tblproperties ('orc.compress'='SNAPPY');